Limit immediate unexpected-EOF retry to statusless errors#2
Merged
Conversation
Co-Authored-By: Hex <hex@codeigniter.org.cn>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the Codex P2 review on router-for-me#3726 ("Preserve cooldown handling for status-bearing EOFs").
The
unexpected EOFfast path inshouldRetryAfterErrornow only fires for statusless errors:Why:
isUnexpectedEOFErrormatches the substring"unexpected eof", so a status-bearing error (e.g. a 5xx whose body text contains "unexpected EOF") could match. For such an errorMarkResulthas already applied a 60s model/auth cooldown. The unconditional fast path returned an immediate retry that selection then rejects with amodel_cooldownerror — and when that cooldown exceedsmax-retry-interval(default 30s) the cooldown error is surfaced to the client without ever retrying upstream. Gating onstatus == 0lets status-bearing errors fall through to the existing cooldown-aware path instead.This does not change the real-world behavior the original fix targeted: genuine
unexpected EOFs in this codebase are statusless — bothio.ReadAll(decodedBody)(claude_executor.go:310-313) andscanner.Err()(claude_executor.go:512-519) return plain errors with noStatusCode().Tests
TestManager_ShouldRetryAfterError_StatusBearingEOFUsesCooldownPath— a 500 error whose message contains "unexpected EOF", with a single cooled-down credential (cooldown > maxWait), returnsshouldRetry=false(no immediate fast path).gofmt,go vet ./sdk/cliproxy/auth/,go build ./...,go test ./...all pass.Link to Devin session: https://app.devin.ai/sessions/eb1be9597f8d44c9af3d671e9fda7c03
Requested by: @hex-ci